#pragma once
#ifndef __KRESOURCEMANAGER_H__
#define __KRESOURCEMANAGER_H__
#include "VResourceManager.h"
#include "VRenderResource.h"
#include "VStaticMeshRender.h"

class KResourceManager : public VAllocator
{
public:
	KResourceManager(void);
	~KResourceManager(void);


	BOOL Init();
	void Shutdown();

	//////////////////////////////////////////////////////////////////////////
	//	Texture Resource Manager
	//////////////////////////////////////////////////////////////////////////
	VTexture* LoadTexture(const char* sName, BOOL Stream = FALSE);

	inline VTexture* FindTexture(UINT Name) const 
	{
		TextureMap::const_iterator itr = m_LoadedTextures.find(Name);
		if (itr != m_LoadedTextures.end())
		{
			return itr->second;
		}
		return NULL;
	}

	//////////////////////////////////////////////////////////////////////////
	//
	//////////////////////////////////////////////////////////////////////////

	VStaticRenderMeshPtr LoadStaticMesh(const char* sName, BOOL Stream = FALSE);

	inline VStaticRenderMesh* FindStaticMesh(UINT Name) const
	{
		StaticMeshMap::const_iterator itr = m_LoadedStaticMeshes.find(Name);
		if(itr != m_LoadedStaticMeshes.end())
		{
			return itr->second;
		}
		return NULL;
	}

private:
	typedef vtpl::map<UINT, VTexture*> TextureMap;
	TextureMap m_LoadedTextures;

	typedef vtpl::map<UINT, VStaticRenderMesh*> StaticMeshMap;
	StaticMeshMap m_LoadedStaticMeshes;

};

extern KResourceManager* g_ResourceManager;


#endif 